﻿using Class_Entity.ObjectTwo;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccess.ObjectTwo
{
   public class D_Update
    {
       DataTable tb = new DataTable();
       ConnectionToDataBase ex = new ConnectionToDataBase();
       public bool UpdateCompany(Companies fx)
       {

           SqlParameter[] sqlParameters = new SqlParameter[7];
           sqlParameters[0] = new SqlParameter("@A", SqlDbType.VarChar);
           sqlParameters[0].Value = fx.COMPANY_CODE;
           sqlParameters[1] = new SqlParameter("@B", SqlDbType.VarChar);
           sqlParameters[1].Value = fx.COMPANY_NAME;
           sqlParameters[2] = new SqlParameter("@C", SqlDbType.VarChar);
           sqlParameters[2].Value = fx.COMPANY_EMAIL;
           sqlParameters[3] = new SqlParameter("@D", SqlDbType.VarChar);
           sqlParameters[3].Value = fx.COMPANY_ADDRESS;
           sqlParameters[4] = new SqlParameter("@E", SqlDbType.VarChar);
           sqlParameters[4].Value = fx.COMPANY_PHONE;
           sqlParameters[5] = new SqlParameter("@F", SqlDbType.VarChar);
           sqlParameters[5].Value = fx.DESCRIPTION;
           sqlParameters[6] = new SqlParameter("@V", SqlDbType.Int);
           sqlParameters[6].Value = fx.COMPANY_ID;
           return ex.executeUpdateQuery("UpdateCompany", sqlParameters);
       }
       public bool UpdateCity(Cities fx)
       {
           SqlParameter[] sqlParameters = new SqlParameter[4];
           sqlParameters[0] = new SqlParameter("@A", SqlDbType.VarChar);
           sqlParameters[0].Value = fx.CITY_CODE;
           sqlParameters[1] = new SqlParameter("@B", SqlDbType.VarChar);
           sqlParameters[1].Value = fx.CITY_NAME;
           sqlParameters[2] = new SqlParameter("@C", SqlDbType.VarChar);
           sqlParameters[2].Value = fx.DESCRIPTION;
           sqlParameters[3] = new SqlParameter("@V", SqlDbType.Int);
           sqlParameters[3].Value = fx.CITY_ID;
           return ex.executeUpdateQuery("UpdateCity", sqlParameters);
       }
    }
}
